﻿using System.Net.Sockets;
using System.Net;
using System.Text;
using System.IO.Pipelines;
using System;
using System.Buffers;
using Client.Keen;

namespace Client
{
    internal class Program
    {
        static void Main(string[] args)
        {
            try
            {
                KeenNetClient client = new KeenNetClient("127.0.0.1", 8007);
                while (true)
                {
                    var count = Console.ReadLine();
                    if (int.TryParse(count, out var value))
                    {
                        Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff"));
                        Parallel.For(0, value, async (i) =>
                        {
                            var msg = $"[{i}]:This is a message from client [{Guid.NewGuid()}]\n";
                            await client.SendAsync(msg);
                        });
                    }

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
    }
}